package cn.snmp.mutual.common.snmp;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;

import cn.snmp.mutual.filter.AbstractFilter;
import cn.snmp.mutual.nms.SnmpVarBind;
import cn.snmp.mutual.nms.util.SnmpTarget;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.snmp4j.AbstractTarget;
import org.snmp4j.CommunityTarget;
import org.snmp4j.MessageException;
import org.snmp4j.PDU;
import org.snmp4j.ScopedPDU;
import org.snmp4j.UserTarget;
import org.snmp4j.security.AuthMD5;
import org.snmp4j.security.AuthSHA;
import org.snmp4j.security.PrivAES128;
import org.snmp4j.security.PrivDES;
import org.snmp4j.security.UsmUser;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.GenericAddress;
import org.snmp4j.smi.Integer32;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.VariableBinding;
import cn.snmp.mutual.data.ObjService;
import cn.snmp.mutual.util.OperatorUtilities;

/**
 * @author dengkn
 * 一次完整交互所有相关信息存放的容器
 * @since 2018.9.16
 */
@Slf4j
public class SnmpNioTarget extends SnmpTarget {

    public static final int SNMP_GET_LIST = 1;
    public static final int SNMP_GET_TABLE = 2;
    public static final int SNMP_GET_TABLE_PAGE = 3;
    public static final int SNMP_GET_TABLE_ROW = 4;
    public static final int SNMP_SET_INFO = 5;
    public static final int SNMP_GET_BULK = 6;
    private LinkedList<String> instances = new LinkedList<String>();
    private LinkedList<ObjService> tpIndexNodeLinkedList = null;
    private LinkedList<ObjService> tpAccessNodeLinkedList = null;
    private HashMap<String, Integer> tpBindTable = null;
    private ObjService tpMibNodeNameTable = null;
    private AbstractFilter tpRowFilter = null;
    private boolean isFinish;
    private int snmpOpType = -1;
    private ObjService osResult;
    private ObjService osParams;
    private AbstractTarget target = null;
    private boolean hasNext = false;
    private String sTBaseOid = null;
    private String sTCurrentOid = null;
    private String[] sToidlist = null;
    private Object orgResult = null;
    private int currentRow = 0;
    private String baseInstance = "";
    private int stepID = 0;
    private int neid = 0;
    private Integer32 requestID;
    private int getBulkCount = 0;
    private SnmpVarBind[] binds = null;
    /**
     * 如果提供了表行数，则getbulk不获取多余数据
     */
    private int tableSize = -1;
    /**
     * for mutual v3 User
     */
    private UsmUser usmUser = null;

    public SnmpNioTarget(ObjService osParams) {
        this.osParams = osParams;
    }

    /**
     * 获得发送给设备的PDU数据
     *
     * @return PDU
     * @throws MessageException
     */
    public PDU getPDU() throws MessageException {
        PDU pdu = null;
        if (m_snmpVersion == VERSION3) {
            pdu = new ScopedPDU();
            ScopedPDU scopedPDU = (ScopedPDU) pdu;
            if (!"".equals(super.m_strContextEngineId)) {
                scopedPDU.setContextEngineID(new OctetString(m_strContextEngineId));
            }
            if (!"".equals(super.m_strContextName)) {
                scopedPDU.setContextName(new OctetString(m_strContextName));
            }
        } else {
            pdu = new PDU();
        }
        switch (this.snmpOpType) {
            case SnmpNioTarget.SNMP_GET_LIST:
                addSGListPDU(pdu);
                break;
            case SnmpNioTarget.SNMP_GET_TABLE:
                addSGTablePDU(pdu);
                break;
            case SnmpNioTarget.SNMP_GET_TABLE_PAGE:
                addSGTPagePDU(pdu);
                break;
            case SnmpNioTarget.SNMP_GET_TABLE_ROW:
                addSGTRow(pdu);
                break;
            case SnmpNioTarget.SNMP_SET_INFO:
                addSSInfo(pdu);
                break;
            case SnmpNioTarget.SNMP_GET_BULK:
                addSGBulkPDU(pdu);
                break;
            default:
                break;
        }
        return pdu;
    }

    private void addSGListPDU(PDU pdu) {
        int length = super.m_oidList.length;
        for (int i = 0; i < length; i++) {
            pdu.add(new VariableBinding(new OID(super.m_oidList[i])));
        }
        pdu.setType(PDU.GET);
    }

    private void addSGTablePDU(PDU pdu) {
        if (this.sTBaseOid == null) {
            this.sTBaseOid = super.m_oidList[0];
            this.sTCurrentOid = this.sTBaseOid;
            this.sToidlist = new String[super.m_oidList.length];
            this.currentRow = super.m_maxRows;
            for (int i = 0; i < super.m_oidList.length; ++i) {
                if (this.baseInstance.equals("")) {
                    this.sToidlist[i] = super.m_oidList[i];
                } else {
                    sToidlist[i] = super.m_oidList[i] + "." + this.baseInstance;
                }
            }
        }
        int length = this.sToidlist.length;
        for (int i = 0; i < length; i++) {
            pdu.add(new VariableBinding(new OID(this.sToidlist[i])));
        }

        pdu.setType(PDU.GETNEXT);
    }

    private void addSGBulkPDU(PDU pdu) {
        if (this.sToidlist == null) {
            this.sToidlist = new String[super.m_oidList.length];
            for (int i = 0; i < super.m_oidList.length; ++i) {
                this.sToidlist[i] = this.m_oidList[i];
            }
        }
        int length = this.sToidlist.length;
        for (int i = 0; i < length; i++) {
            pdu.add(new VariableBinding(new OID(this.sToidlist[i])));
        }
        pdu.setMaxRepetitions(super.m_maxRows);
        pdu.setType(PDU.GETBULK);
    }

    private void addSGTPagePDU(PDU pdu) {
        addSGTablePDU(pdu);
    }

    private void addSGTRow(PDU pdu) {
        if (this.instances.isEmpty()) {
            addSGListPDU(pdu);
        } else {
            int length = super.m_oidList.length;
            for (int i = 0; i < length; i++) {
                pdu.add(new VariableBinding(new OID(super.m_oidList[i] + this.instances.get(0))));
            }
            pdu.setType(PDU.GET);
        }
    }

    private void addSSInfo(PDU pdu) throws MessageException {
        if (binds == null) {
            throw new MessageException("Do not have oid and oid value");
        }
        int len = binds.length;
        for (int i = 0; i < len; i++) {
            pdu.add(new VariableBinding(new OID(binds[i].getObjectID().toString()), SnmpNioTargetUtilities.changeVariable(binds[i].getVariable())));
        }
        pdu.setType(PDU.SET);

    }

    /**
     * 获得SNMP4j的Target实例V3
     *
     * @return
     */
    public CommunityTarget getTarget() {
        if (target == null) {
            Address targetAddress = GenericAddress.parse("udp:" + super.m_targetHost + "/" + super.m_targetPort);
            target = new CommunityTarget();
            ((CommunityTarget) target).setCommunity(new OctetString(super.m_community));
            target.setAddress(targetAddress);
            // 通信不成功时的重试次数
            target.setRetries(super.m_retries);
            // 超时时间
            target.setTimeout(super.m_timeout * 1000);
            target.setVersion(super.m_snmpVersion);

        }
        return (CommunityTarget) target;
    }

    public AbstractTarget getTarget(SnmpNioTarget snmpNioTarget) {
        if (target == null) {
            Address targetAddress = GenericAddress.parse("udp:" + super.m_targetHost + "/" + super.m_targetPort);
            if (m_snmpVersion == VERSION3) {
                OID authOID = null;
                OID privOID = null;
                OctetString authPassphase = null;
                OctetString privPassPhase = null;

                target = new UserTarget();
                UserTarget userTarget = (UserTarget) target;
                if (super.m_bUseAuthentication) {
                    if (m_iAuthenticationProtocol == MD5_PROTOCOL) {
                        authOID = AuthMD5.ID;
                    } else if (m_iAuthenticationProtocol == SHA1_PROTOCOL) {
                        authOID = AuthSHA.ID;
                    }
                    authPassphase = new OctetString(super.m_strUserAuthenticationPassword);
                    if (super.m_bUsePrivacy) {
                        userTarget.setSecurityLevel(3);

                        if (m_iPrivacyProtocol == DES_PROTOCOL) {
                            privOID = PrivDES.ID;
                        } else if (m_iPrivacyProtocol == AES_PROTOCOL) {
                            privOID = PrivAES128.ID;
                        }
                        privPassPhase = new OctetString(super.m_strUserPrivacyPassword);
                    } else {
                        userTarget.setSecurityLevel(2);
                    }
                } else {
                    userTarget.setSecurityLevel(1);
                }
                usmUser = new UsmUser(new OctetString(super.m_strUserName), authOID, authPassphase, privOID, privPassPhase);

                if (!"".equals(super.m_strContextEngineId)) {
                    userTarget.setAuthoritativeEngineID(new OctetString(m_strContextEngineId).getValue());
                }
                userTarget.setSecurityName(new OctetString(super.m_strUserName));

            } else {
                target = new CommunityTarget();
                ((CommunityTarget) target).setCommunity(new OctetString(super.m_community));
            }
            target.setAddress(targetAddress);
            // 通信不成功时的重试次数
            target.setRetries(super.m_retries);
            // 超时时间
            target.setTimeout(super.m_timeout * 1000);
            target.setVersion(super.m_snmpVersion);

        }
        return target;
    }

    /**
     * 将设备返回结果保存到Target中，并进行简单数据处理
     *
     * @param pdu
     */
    public boolean operateOrgResult(SnmpVarBind[] orgRt, PDU pdu) {
        int errS = pdu.getErrorStatus();
        if (errS != 0) {
            this.m_errCode = errS;
            this.m_errDesc = pdu.getErrorStatusText();
            this.hasNext = false;
        }
        log.debug("snmpOpType = " + snmpOpType);
        switch (this.snmpOpType) {
            case SnmpNioTarget.SNMP_GET_LIST:
                operSGList(orgRt);
                break;
            case SnmpNioTarget.SNMP_GET_TABLE:
                operSGTable(orgRt);
                break;
            case SnmpNioTarget.SNMP_GET_TABLE_PAGE:
                operSGTPage(orgRt);
                break;
            case SnmpNioTarget.SNMP_GET_TABLE_ROW:
                operSGTRow(orgRt);
                break;
            case SnmpNioTarget.SNMP_SET_INFO:
                operSSInfo(orgRt);
                break;
            case SnmpNioTarget.SNMP_GET_BULK:
                operSGBulk(orgRt);
                break;
            default:
                break;
        }
        return true;
    }

    private ArrayList<SnmpVarBind> orgRtL = new ArrayList<SnmpVarBind>();

    private void operSGList(SnmpVarBind[] orgRt) {
        if (orgRt != null) {
            int len = orgRt.length;
            for (int i = 0; i < len; i++) {
                orgRtL.add(orgRt[i]);
            }
        }
        if (!this.hasNext) {
            this.orgResult = orgRtL;
        }
    }

    private LinkedList<SnmpVarBind[]> ostv = new LinkedList<SnmpVarBind[]>();

    private void operSGTable(SnmpVarBind[] orgRt) {
        if (this.currentRow > 0) {
            if (orgRt == null) {
                this.hasNext = false;
            } else {

                String strNextOid = orgRt[0].getObjectID().toString();
                String strNextOidFrist = strNextOid.substring(0, strNextOid.length() - 5);


         /*       if (strNextOid.startsWith(".1.3.6.1.4.1.8886.6.1.36.2.1.1")) {
                    if (orgRt[0].getObjectID().toString() != null) {
                        if (orgRt[0].getObjectID().toString().equals(".1.3.6.1.4.1.8886.6.1.36.2.1.1.2")) {
                            strNextOid = orgRt[0].getObjectID().toString();
                        } else {
                            strNextOid = orgRt[1].getObjectID().toString();
                        }
                    }
                }*/

                if (!(this.sTBaseOid).startsWith(strNextOidFrist) || this.sTCurrentOid.equals(strNextOid)) {

                    this.hasNext = false;
                } else {

                    this.baseInstance = OperatorUtilities.getInstance(super.m_oidList, orgRt);
                    if ("".equals(this.baseInstance)) {
                        this.hasNext = false;
                    } else {
                        for (int i = 0; i < this.sToidlist.length; ++i) {
                            sToidlist[i] = super.m_oidList[i] + "." + this.baseInstance;
                        }
                        this.sTCurrentOid = strNextOid;
                        ostv.add(orgRt);
                        this.currentRow--;
                        super.m_retries = osParams.getIntValue("Retry");
                        this.hasNext = true;
                    }
                }
            }
        } else {
            this.hasNext = false;
        }
        if (!this.hasNext) {
            if (ostv == null) {
                ostv.add(orgRt);
            }
            if (ostv.size() == 0) {
                ostv.add(orgRt);
            }
            SnmpVarBind[][] bindsList = new SnmpVarBind[ostv.size()][this.m_oidList.length];
            for (int i = 0; i < ostv.size(); ++i) {
                bindsList[i] = ((SnmpVarBind[]) ostv.get(i));
            }
            this.orgResult = bindsList;
        }
    }

    private void operSGBulk(SnmpVarBind[] orgRt) {
        if (orgRt == null) {
            this.hasNext = false;
        } else {
            int stsize = this.sToidlist.length;
            int orgsize = orgRt.length;
            int count = 0;
            while (count < super.m_maxRows) {
                SnmpVarBind[] curRt = new SnmpVarBind[stsize];
                for (int i = 0; i < stsize; i++) {
                    int index = i + count * stsize;
                    if (index >= orgsize) {
                        this.hasNext = false;
                        break;
                    }
                    String strOid = orgRt[index].getObjectID().toString();
                    if (!strOid.startsWith(m_oidList[i])) {
                        this.hasNext = false;
                        break;
                    }
                    curRt[i] = orgRt[index];

                    this.hasNext = true;
                }
                if (this.hasNext) {
                    ostv.add(curRt);
                    count++;
                } else {
                    break;
                }
            }
            if (this.hasNext) {
                super.m_retries = osParams.getIntValue("Retry");
                for (int i = 0; i < stsize; i++) {
                    this.sToidlist[i] = orgRt[orgsize - stsize + i].getObjectID().toString();
                }
            }
        }
        //如果表知道表行数，根据表行数与getbulk次数确认是否需要获取下一组数据
        if (this.tableSize >= 0) {
            this.getBulkCount++;
            if (this.tableSize > this.getBulkCount * this.m_MaxRepetitions) {
                int remaining = this.tableSize - (this.getBulkCount * this.m_MaxRepetitions);
                this.hasNext = true;
                if (remaining <= this.m_MaxRepetitions) {
                    this.m_maxRows = remaining;
                }
            } else {
                this.hasNext = false;
            }
        }

        if (!this.hasNext) {
            int osize = ostv.size();
            SnmpVarBind[][] bindsList = new SnmpVarBind[osize][this.m_oidList.length];
            for (int i = 0; i < osize; ++i) {
                bindsList[i] = ((SnmpVarBind[]) ostv.get(i));
            }
            this.orgResult = bindsList;
        }
    }

    public boolean ishasNext() {
        return hasNext;
    }

    public void sethasNext(boolean hasNext) {
        this.hasNext = hasNext;
    }

    public int getTableSize() {
        return tableSize;
    }

    public void setTableSize(int tableSize) {
        this.tableSize = tableSize;
    }

    private void operSGTRow(SnmpVarBind[] orgRt) {
        if (!this.instances.isEmpty()) {
            if (this.m_errCode != 0) {
                this.hasNext = false;
            }
            this.instances.remove(0);
            if (!this.instances.isEmpty()) {
                super.m_retries = osParams.getIntValue("Retry");
                this.hasNext = true;
            } else {
                this.hasNext = false;
            }
        }
        operSGList(orgRt);
    }

    private void operSGTPage(SnmpVarBind[] orgRt) {
        operSGTable(orgRt);
    }

    private void operSSInfo(SnmpVarBind[] orgRt) {
        this.orgResult = orgRt;
    }

    /**
     * 判断SNMP 是否采集结束
     *
     * @return
     */
    public void setFinishTag(boolean value) {
        isFinish = value;
    }

    public boolean isFinish() {
        return isFinish;
    }

    /**
     * 创建最终结果数据结构，以及相关属性
     */
    public void setResult(ObjService result) {
        osResult = result;
    }

    /**
     * 获得最终的格式化的采集结果
     *
     * @return
     */
    public ObjService getResult() {
        return osResult;
    }

    /**
     * 配置SNMP 操作 类型
     *
     * @param value 1-SNMP_GET_LIST 2-SNMP_GET_TABLE 3-SNMP_GET_TABLEPage
     *              4-SNMP_GET_TABLE_ROW
     */
    public void setSNMPOpType(int value) {
        this.snmpOpType = value;
    }

    /**
     * used for circle-getting SNMP Table Row
     */
    public void setInstances(LinkedList<String> instances) {
        this.instances = instances;
    }


    /**
     * 是否有未采集的OID if(hasNextPDU()){ PDU pdu = getPDU(); }
     */
    public boolean hasNextPDU() {
        return this.hasNext;
    }

    public void setStepId(int stepId) {
        this.stepID = stepId;
    }

    public int getStepId() {
        return this.stepID;
    }

    public void setNEId(int neid) {
        this.neid = neid;
    }

    public int getNEID() {
        return this.neid;
    }

    /**
     * 获得原始的传入参数
     *
     * @return
     */
    public ObjService getOsParam() {
        return this.osParams;
    }

    public int getTimeOut() {
        return super.m_timeout * 1000;
    }

    public int getReTries() {
        return super.m_retries;
    }

    /**
     * 获得Target的SNMP 操作类型
     *
     * @see #setSNMPOpType(int)
     */
    public int getSnmpOpType() {
        return this.snmpOpType;
    }

    /**
     * 获得原始的采集结果
     *
     * @return obj SNMP_GET_LIST/SNMP_GET_TABLE_ROW 的返回类型为ArrayList<SnmpVarBind>
     * <p>
     * </p>
     * SNMP_GET_TABLE/SNMP_GET_TABLEPage 的返回类型为SnmpVarBind[][]
     */
    public Object getOrgResult() {
        return this.orgResult;
    }

    /**
     * 获得要采集的OID前缀
     */
    public String[] getOidList() {
        return this.m_oidList;
    }

    /**
     * 获得要采集的OID实例 used for SNMP_GET_TABLEPage
     */
    public void setBaseInstance(String sbi) {
        this.baseInstance = sbi;
    }

    public void setErrCode(int code) {
        super.m_errCode = code;
    }

    public void setErrDes(String des) {
        super.m_errDesc = des;
    }

    @Override
    public void setSnmpVersion(int snmpVersion) {
        super.m_snmpVersion = snmpVersion;
    }

    /**
     * 缓存SNMP_GET_TABLEPage 处理参数 used for SNMP_GET_TABLEPage
     *
     * @see #operSGTPage(SnmpVarBind[])
     */
    public void setSTPageParam(LinkedList<ObjService> inv, LinkedList<ObjService> anv, HashMap<String, Integer> bt, ObjService mnt, AbstractFilter rf) {
        this.tpIndexNodeLinkedList = inv;
        this.tpAccessNodeLinkedList = anv;
        this.tpBindTable = bt;
        this.tpMibNodeNameTable = mnt;
        this.tpRowFilter = rf;
    }

    private LinkedList<ObjService> trVIndexNodes = null;
    private LinkedList<ObjService> trvAccessNodes = null;

    /**
     * 缓存 SNMP_GET_TABLE_ROW 处理参数 used for SNMP_GET_TABLE_ROW
     */
    public void setSTRowParam(LinkedList<ObjService> vIndexNodes, LinkedList<ObjService> vAccessNodes) {
        this.trVIndexNodes = vIndexNodes;
        this.trvAccessNodes = vAccessNodes;
    }

    /**
     * 缓存 SNMP_GET_TABLE_ROW 处理参数 used for SNMP_GET_TABLE_ROW
     */
    public LinkedList<ObjService> getTRIndexNodes() {
        return this.trVIndexNodes;
    }

    /**
     * 缓存 SNMP_GET_TABLE_ROW 处理参数 used for SNMP_GET_TABLE_ROW
     */
    public LinkedList<ObjService> getTRAccessNodes() {
        return this.trvAccessNodes;
    }

    /**
     * 缓存 SNMP 的request ID
     */
    public Integer32 getRequestID() {
        return this.requestID;
    }

    public void setRequestID(Integer32 requestID) {
        this.requestID = requestID;
    }

    public String getAddress() {
        return target.getAddress().toString();
    }

    public void setBinds(SnmpVarBind[] binds) {
        this.binds = binds;
    }

    public UsmUser getUsmUser() {
        return usmUser;
    }

    @Override
    public String toString() {
        StringBuilder mes = new StringBuilder();
        mes.append("m_community = " + super.m_community + "\n");
        mes.append("AuthenticationProtocol = " + super.m_iAuthenticationProtocol + "\n");
        mes.append("MaxRepetitions = " + super.m_MaxRepetitions + "\n");
        mes.append("maxRows = " + super.m_maxRows + "\n");
        mes.append("NonRepeaters = " + super.m_NonRepeaters + "\n");
        mes.append("retries = " + super.m_retries + "\n");
        mes.append("Version = " + super.m_snmpVersion + "\n");
        mes.append("ContextEngineId = " + super.m_strContextEngineId + "\n");
        mes.append("ContextName = " + super.m_strContextName + "\n");
        mes.append("strUserAuthenticationPassword = " + super.m_strUserAuthenticationPassword + "\n");
        mes.append("UserName = " + super.m_strUserName + "\n");
        mes.append("UserPrivacyPassword = " + super.m_strUserPrivacyPassword + "\n");
        mes.append("Host = " + super.m_targetHost + "\n");
        mes.append("Port = " + super.m_targetPort + "\n");
        mes.append("timeout = " + super.m_timeout + "\n");
        mes.append("m_writeCommunity = " + super.m_writeCommunity + "\n");
        switch (this.snmpOpType) {
            case SnmpNioTarget.SNMP_GET_LIST:
                mes.append("snmpOpType = SNMP_GET_LIST\n");
                break;
            case SnmpNioTarget.SNMP_GET_TABLE:
                mes.append("snmpOpType = SNMP_GET_TABLE\n");
                break;
            case SnmpNioTarget.SNMP_GET_TABLE_PAGE:
                mes.append("snmpOpType = SNMP_GET_TABLEPage\n");
                break;
            case SnmpNioTarget.SNMP_GET_TABLE_ROW:
                mes.append("snmpOpType = SNMP_GET_TABLE_ROW\n");
                break;
            default:
                break;
        }
        mes.append("OIDs=========================\n");
        if (super.m_oidList != null) {
            int length = super.m_oidList.length;
            for (int i = 0; i < length; i++) {
                mes.append(super.m_oidList[i] + "\n");
            }
        }
        return mes.toString();
    }

    public void clearResult() {
        ostv.clear();
        this.orgResult = null;
    }

    public LinkedList<ObjService> getTpIndexNodeLinkedList() {
        return tpIndexNodeLinkedList;
    }

    public void setTpIndexNodeLinkedList(LinkedList<ObjService> tpIndexNodeLinkedList) {
        this.tpIndexNodeLinkedList = tpIndexNodeLinkedList;
    }

    public LinkedList<ObjService> getTpAccessNodeLinkedList() {
        return tpAccessNodeLinkedList;
    }

    public void setTpAccessNodeLinkedList(LinkedList<ObjService> tpAccessNodeLinkedList) {
        this.tpAccessNodeLinkedList = tpAccessNodeLinkedList;
    }

    public HashMap<String, Integer> getTpBindTable() {
        return tpBindTable;
    }

    public void setTpBindTable(HashMap<String, Integer> tpBindTable) {
        this.tpBindTable = tpBindTable;
    }

    public ObjService getTpMibNodeNameTable() {
        return tpMibNodeNameTable;
    }

    public void setTpMibNodeNameTable(ObjService tpMibNodeNameTable) {
        this.tpMibNodeNameTable = tpMibNodeNameTable;
    }

    public AbstractFilter getTpRowFilter() {
        return tpRowFilter;
    }

    public void setTpRowFilter(AbstractFilter tpRowFilter) {
        this.tpRowFilter = tpRowFilter;
    }

    public void clear() {
        this.instances.clear();
        this.osResult.clearValue();
        this.osParams.clearValue();
        this.target = null;
        this.sToidlist = null;
        this.orgResult = null;
        this.trVIndexNodes = null;
        this.trvAccessNodes = null;
        this.tpIndexNodeLinkedList = null;
        this.tpAccessNodeLinkedList = null;
        this.tpBindTable = null;
        this.tpMibNodeNameTable = null;
        this.tpRowFilter = null;
        this.orgRtL.clear();
        this.ostv.clear();
        super.m_oidList = null;
        super.context = null;
        super.m_operations = null;
    }
}